/**
 * Created by Administrator on 13-12-7.
 */
$(function(){
    $("#wangzhan").hover(
        function(){
            $("#wywy").css({"visibility":"visible"});
            $("#wang").css({"visibility":"hidden"});
        },
        function(){
            $("#wywy").css({"visibility":"hidden"});
            $("#wang").css({"visibility":"visible"});
        }
    )
    $(".rotate").hover(
        function(){
            console.log(1213);
            $(this).find(".roimg").css({
                "transform":"rotate(180deg)",
                "animation":"roimg  1s liear"})
        },
        function(){
            console.log("gh");
            $(this).find(".roimg").css({"transform":"rotate(0deg)"})
        }
    )
    $(".navright ul li").hover(
        function(){$(this).find("div:nth-child(2)").css({"display":"block"})},
        function(){$(this).find("div:nth-child(2)").css({"display":"none"})}
    )
    $(".smallepage span").hover(
        function(){
            $(this).find("a").css({"display":"block"});
            $(this).find("img").css({"display":"none"});
            $(this).css({"border":"1px solid #C10001"});
        },
        function(){
            $(this).find("a").css({"display":"none"});
            $(this).find("img").css({"display":"block"});
            $(this).css({"border":"1px solid #999999"});
        }
    )
})

/*====================轮播图===============================*/
$(function(){
    var page=0;
    var timer;
    function run(){
        $("#images>ul>li").eq(page).fadeIn(1000);
        $(".yuan li").eq(page).css({"background":"red"});
        $("#images>ul>li").eq(page).siblings().fadeOut(1000);
        $(".yuan li").eq(page).siblings().css({"background":"gainsboro"})
        page++;
        if(page==5){
            page=0;
        }
        timer=setTimeout(run,3000);
    }
    run(0);
    $("#box").hover(
        function(){clearTimeout(timer)},
        function(){timer=setTimeout(run,3000);}
    )
    $(".yuan li").click(function(){
        var index=$(this).index();
        $(this).css({"background":"red"});
        $(this).siblings().css({"background":"gainsboro"});
        $("#images>ul>li").eq(index).show();
        $("#images>ul>li").eq(index).siblings().hide();
        if(page==5){
            page=0;
        }
    })
})


/*=====================导航二级菜单================*/
$(function(){
    $(".listmore").hover(
        function(){
            $("#cela").css({"color":"#fff","font-size":"16px"});
            $("#listall").css({"display":"block"});
            $("#listall>ul>li").hover(
                function(){
                    var index=$(this).index();
                    $("#listall>ul>li").eq(index).find(".list-third").css({"display":"block"});
                console.log(index)
                },
                function(){
                    var index=$(this).index();
                    $("#listall>ul>li").eq(index).find(".list-third").css({"display":"none"});
                console.log(index)}
            )
        },
        function(){
            $("#cela").css({"color":"yellow","font-size":"14px"});
            $("#listall").css({"display":"none"});
        }

    )

});
/*===============关键词搜索=========*/
$(function(){
    var sinput=document.getElementById("search_input");
    var slist=document.getElementById("seach_list");
    sinput.addEventListener("input",function(){
        var arr=["白鸭绒","儿童羽绒","男士羽绒","女士羽绒","长款羽绒","潮款羽绒","短款羽绒","超薄羽绒","东北大棉服","2016新款羽绒"];
        var arr1=["套装","羽绒","毛呢大衣","短裙","长裙","衬衣","鱼尾裙","蓬蓬裙","蓬蓬大衣","皮裤"];
        var arr2=["西服","棉服","男士羽绒","西裤","夹克","长款大衣","短款羽绒","围巾","T恤","毛衣"];
        if($("#search_input").val()=="羽绒"){
            $("#seach_list").empty();
            for(var i in arr){
                var li=document.createElement("li");
                var litext=document.createTextNode(arr1[i]);
                li.className="chooseon";
                li.appendChild(litext);
                slist.appendChild(li);
            }
            $("#seach_list").css({"display":"block"});
            $("#seach_list li").click(function(){$("#search_input").val($(this).text());})
        }
        if(document.getElementById("search_input").value=='女装'){
            $("#seach_list").empty();
            for(var i=0;i<arr1.length;i++){
                var li=document.createElement("li");
                var litext=document.createTextNode(arr1[i]);
                li.className="chooseon";
                li.appendChild(litext);
                slist.appendChild(li);
            }
            $("#seach_list").css({"display":"block"});
            $("#seach_list li").click(function(){$("#search_input").val($(this).text());})
        }
        if(sinput.value =='男装'){
            $("#seach_list").empty();
            for(var i=0;i<arr2.length;i++){
                var li=document.createElement("li");
                var litext=document.createTextNode(arr2[i]);
                li.className="chooseon";
                li.appendChild(litext);
                slist.appendChild(li);
            }
            $("#seach_list").css({"display":"block"});
            $("#seach_list li").click(function(){$("#search_input").val($(this).text());})
        }

    });
    $("body").click(function(){
        $("#seach_list").empty();
        $("#seach_list").css({"display":"none"})
    })



})


